<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    <input type="text" value="" id="txt">
    <input type="button" value="按钮" id="btn">
    <input type="text" value="" id="result" readonly>
</body>
<script>

    var txt = document.getElementById("txt");
    var btn = document.getElementById("btn");
    var result = document.getElementById("result");

    btn.onclick = function(){
        // 获取
        // console.log(txt.value);
        var n = txt.value-0;

        // 处理
        // switch(txt.value){
        //     case 5:
        //         console.log("hello");break;
        //     default:
        //         console.log("输入错误");
        // }

        // 处理
        n = n<10 ? "0"+n : n;

        // 设置
        result.value = n
    }





</script>
</html>